package com.ww.springboot.boot.baseTest.基本类型.字符串;

/**
 * 描述：
 *
 * @author 🧑 ‍wanwei⛑⚽
 * @since 2024-12-10 11:26
 */
public class LengthDemo2 {

    public static void main(String[] args) {
//        for (int i = 19975; i <= 20255; i++) {
//            System.out.println(i + "" + (char)i);
//        }
//        System.out.println(Integer.valueOf('万'));
//        System.out.println(Integer.valueOf('伟'));
        //System.out.println(String.valueOf((char)20255));

        // 原始ISO-8859-1编码的字符串
        String isoString = "This is a test string";

        // 将ISO-8859-1编码的字节转换为UTF-8编码的字节
        try {
            byte[] utf8Bytes = isoString.getBytes("ISO-8859-1");
            String utf8String = new String(utf8Bytes, "UTF-8");
            String utf8String2 = new String(utf8Bytes);

            // 输出转换后的字符串
            System.out.println("UTF-8 Encoded String: " + utf8String);
            System.out.println(utf8String2);
        } catch (java.io.UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }
}
